
<%@page import="study.itwill.team5.board.BoardCategory"%>
<%@page import="study.itwill.team5.board.BoardCategoryItem"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@include file="../dbcon.jsp"%>
<%
	ArrayList<BoardCategoryItem> list = (new BoardCategory()).listBoardCategory();
	

	if (list == null) {
		out.print("<script type='text/javascript'>alert('데이터 조회 실패'); history.back();</script>");
		return;
	}
%>
<!DOCTYPE html>
<html lang="ko">
<head>
<%@include file="../head.jsp"%>
</head>

<body>
	<%@include file="../menu.jsp"%>
	<%DBHandler.disconnect();%>

	<!-- 메뉴바 -->
	<div class="container">
		<div class="page-header clearfix">
			<h1 class="pull-left">게시판 카테고리 목록</h1>
			<div class="pull-right" style="padding-top: 30px">
				<a href="addBoardCategory.jsp" class="btn btn-info">추가하기</a>
			</div>
		</div> 
		
		<div class="table-responsive">
			<table class="table table-striped table-hover">
				<thead>
					<tr class="warning">
						
						<th class="text-center">일련번호</th>
						<th class="text-center">카테고리 이름</th>
						<th class="text-center">등록 일자</th>
						<th class="text-center">수정 일자</th>
					</tr>
				</thead>
				<tbody>
					<%
						if (list.size() < 1) {
					%>
					<tr>
						<td colspan="5">
							<p class="text-center text-warning" style="height: 100px">
								저장한 데이터가 없습니다.</p>
						</td>
					</tr>
					<%
						} else {
							for(int i=0; i<list.size(); i++){
								BoardCategoryItem item = list.get(i);
					%>
					<tr class="text-center">
					
						<td><%=item.getSeq()%></td>
						<td><%=item.getCategory_name()%></td>
						<td><%=item.getReg_date()%></td>
						<td><%=item.getEdit_date()%></td>
						
						
						<td><a href="viewBoardCategory.jsp?seq=<%=item.getSeq()%>"
							class="btn btn-sm btn-primary">정보보기</a></td>


					</tr>

					<%
						}
					}
					%>


				</tbody>
			</table>
		</div>
	</div>

	<!-- Javascript -->
	<script src="/italia/assets/js/jquery.js"></script>
	<script src="/italia/assets/js/bootstrap.min.js"></script>
</body>
</html>






